package lex.mtd.core;

public class SimpleContentLengthVerifier implements ContentLengthVerifier
{
	protected long contentLength = -1L;

	public SimpleContentLengthVerifier()
	{
		this( -1L );
	}

	public SimpleContentLengthVerifier( long length )
	{
		this.contentLength = length;
	}

	@Override
	public long getContentLength()
	{
		return contentLength;
	}

	@Override
	public boolean verifyContentLength( long length )
	{
		if( -1 == this.contentLength )
		{
			this.contentLength = length;
			return true;
		}
		else if( length != this.contentLength )
			return false;
		else
			return true;
	}
}
